package com.miracle9.game.util;

import java.io.InputStream;

public class AuxiliaryCodingKey extends ClassLoader
{
  public static String key = "ktznqmxlgzppazsc";
  
  public Class ProcessDefineClass(String name)
  {
    Class claz = null;
    try
    {
      byte[] rawData = getSecurityFileInfo();
      if (rawData != null) {
        claz = defineClass(name, rawData, 0, rawData.length);
      }
    }
    catch (Exception e)
    {
      claz = null;
    }
    return claz;
  }
  
  private byte[] getSecurityFileInfo()
  {
    try
    {
      InputStream in = AuxiliaryCodingKey.class.getClassLoader().getResourceAsStream("security.data");
      byte[] bs = new byte[in.available()];
      in.read(bs);
      bs = MyUtil.Base64Decode(bs, key);
      in.close();
      return bs;
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
    return null;
  }
}
